/******************************************
*******************************************
*****                                 *****
*****  请使用 TXT文本工具 浏览源程序  *****
*****                                 *****
*******************************************
******************************************/

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//  Prorgam:        EPD_Demo
//  Author:         Yuhu Lin
//  Date:           2018.06.07.
//  Rev:            2.0
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//  Rev History     Author      Date            Modification
//  1.0             YQLIN       2015.05.06.     Create     
//  1.1             Yuhu Lin	2016.11.17.     Add uart, flash_write, img & waveform download	
//  2.0		    Yuhu Lin	2018.06.07.	EPD_Demo	    
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//Includes
#include "OPM021B1.h"
#include "appconfig.h"
#ifdef USING_OPM021B1_EPD
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//I/O port define
#define EPD_SI_H         	  gpio_output_set(BIT14, 0, BIT14, 0)  
#define EPD_SI_L           	gpio_output_set(0, BIT14, BIT14, 0)
#define EPD_SCK_H   	   	  gpio_output_set(BIT13, 0, BIT13, 0) 
#define EPD_SCK_L   	   	  gpio_output_set(0, BIT13, BIT13, 0) 
#define EPD_CS_H   	        gpio_output_set(0, BIT4, BIT4, 0) 
#define EPD_CS_L   	        gpio_output_set(0, BIT4, BIT4, 0)
#define EPD_DC_H   	        gpio_output_set(BIT12, 0, BIT12, 0)  	
#define EPD_DC_L   	        gpio_output_set(0, BIT12, BIT12, 0)
#define EPD_RST_H  	        gpio_output_set(BIT2, 0, BIT2, 0)
#define EPD_RST_L   	  	  gpio_output_set(0, BIT2, BIT2, 0)

#define EPD_BUSY		(GPIO_INPUT_GET(GPIO_ID_PIN(5)))		//P1.2

//#define LED_WORK_H		(P2OUT |=BIT0)  	// P2.0		
//#define LED_WORK_L		(P2OUT &=~BIT0) 
//#define LED_PRO_H		(P2OUT |=BIT1)  	// P2.1		
//#define LED_PRO_L		(P2OUT &=~BIT1) 

//#define KEY_01			(P4IN & BIT6) 		//P4.6

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//
#define DELAY_TIME		1   		// 图片显示完停留时间(单位:S)

	
#define PIC_NONE		0
#define PIC_WHITE		20	
#define PIC_BLACK		21
#define PIC_Source_Line     	22  		// Source线
#define PIC_Gate_Line      	23  		// Gate线
#define PIC_Dot     		24  		// 单像素棋盘格
#define PIC_Name     		25  		// 方向图


//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

const unsigned char WF_200MS[]={
	0x44,0xAA,0x55,0xAA,0x55,0xAA,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x0A,0x01,0x00,0x00,0x00,0x00,0x00,	
};
const unsigned char WF_300MS[]={
	0x44,0xAA,0x55,0xAA,0x55,0xAA,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x0F,0x01,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char WF_500MS[]={
	0x44,0xAA,0x55,0xAA,0x55,0xAA,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x19,0x19,0x19,0x19,0x19,0x19,0x19,0x01,0x00,0x00,0x00,0x00,0x00,
};
const unsigned char WF_700MS[]={
	0x44,0x44,0xAA,0x55,0xAA,0xAA,0x11,0x11,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0x1E,0x05,0x3F,0x1F,0x1E,0x05,0x1E,0x05,0x01,0x00,0x00,0x00,0x00,
};

const unsigned char PIC_Orientation[4000] = { /* 0X01,0X01,0XFA,0X00,0X80,0X00, */
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,
0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF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FF,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0XF9,0XFF,0XFF,0XFF,
0XFF,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XF9,0XF8,0X3F,0XFF,0XFF,
0XFF,0X30,0X00,0X01,0XF1,0XFF,0XF0,0X07,0XC6,0X00,0X00,0X19,0XF8,0X03,0XFF,0XFF,
0XFF,0X30,0X00,0X01,0XF1,0XFF,0XF0,0X07,0XC6,0X00,0X00,0X19,0XFF,0X00,0XFF,0XFF,
0XFF,0X30,0X00,0X01,0XF0,0X06,0X30,0X07,0XC6,0X00,0X00,0X19,0XFF,0XF0,0XFF,0XFF,
0XFF,0X31,0XFF,0XF1,0XF0,0X06,0X3E,0X07,0XC6,0X3F,0XFE,0X19,0XFF,0X00,0XFF,0XFF,
0XFF,0X31,0XFF,0XF1,0XF0,0X06,0X3E,0X07,0XC6,0X3F,0XFE,0X19,0XF8,0X07,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0XF0,0X00,0X30,0X00,0X06,0X30,0X06,0X19,0XF8,0X7F,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0XFE,0X00,0X30,0XC0,0X06,0X30,0X06,0X19,0XF8,0X07,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0XFE,0X00,0X30,0XC0,0X06,0X30,0X06,0X19,0XFF,0X00,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0XFE,0X3F,0X80,0XC6,0X06,0X30,0X06,0X19,0XFF,0XF0,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0XFE,0X3F,0X80,0XC6,0X06,0X30,0X06,0X19,0XFF,0X00,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0X86,0X07,0X80,0X00,0X06,0X30,0X06,0X19,0XF8,0X03,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0X87,0X87,0XF0,0X30,0XFE,0X30,0X06,0X19,0XF8,0X3F,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0X87,0X87,0XF0,0X30,0XFE,0X30,0X06,0X19,0XF9,0XFF,0XFF,0XFF,
0XFF,0X31,0X80,0X31,0X86,0X06,0X00,0X00,0XFE,0X30,0X06,0X19,0XF9,0XFF,0XFF,0XFF,
0XFF,0X31,0XFF,0XF1,0X86,0X3E,0X07,0XC0,0XFE,0X3F,0XFE,0X19,0XF8,0X3F,0XFF,0XFF,
0XFF,0X31,0XFF,0XF1,0X86,0X3E,0X07,0XC0,0XFE,0X3F,0XFE,0X19,0XF8,0X03,0XFF,0XFF,
0XFF,0X30,0X00,0X01,0X86,0X30,0X06,0X00,0XC6,0X00,0X00,0X19,0XFF,0X00,0XFF,0XFF,
0XFF,0X30,0X00,0X01,0X86,0X31,0X86,0X30,0XC6,0X00,0X00,0X19,0XFF,0XF0,0XFF,0XFF,
0XFF,0X30,0X00,0X01,0X86,0X31,0X86,0X30,0XC6,0X00,0X00,0X19,0XFF,0X00,0XFF,0XFF,
0XFF,0X3F,0XFF,0XFF,0X80,0X30,0X00,0X00,0X07,0XFF,0XFF,0XF9,0XF8,0X07,0XFF,0XFF,
0XFF,0X3F,0XFF,0XFF,0X80,0X30,0X00,0X00,0X07,0XFF,0XFF,0XF9,0XF8,0X7F,0XFF,0XFF,
0XFF,0X3C,0X3F,0X80,0X00,0X00,0X00,0X00,0X00,0X00,0XFF,0XF9,0XF8,0X07,0XFF,0XFF,
0XFF,0X3C,0X3F,0X80,0X31,0X81,0X80,0X06,0X00,0X00,0XFF,0XF9,0XFF,0X00,0XFF,0XFF,
0XFF,0X3C,0X3F,0X80,0X31,0X81,0X80,0X06,0X00,0X00,0XFF,0XF9,0XFF,0XF0,0XFF,0XFF,
0XFF,0X3C,0X0C,0X00,0X31,0X80,0X00,0X06,0X00,0X00,0XFF,0XF9,0XFF,0X00,0XFF,0XFF,
0XFF,0X3F,0X8C,0X3F,0XF1,0X80,0X06,0X3F,0XFE,0X3F,0XFF,0XF9,0XF8,0X03,0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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 模组读忙
void EpdReadBusyStatus()
{ 
	while(1)
	{
		delay_ms(1);
		if(EPD_BUSY == 0)
	  { 		 
	    break;
	  }
	}      
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 模组写命令
void EpdSendCmd(unsigned char cmd)
{
  	unsigned char scnt;

  	EPD_SCK_L;
  	EPD_DC_L;
  	EPD_CS_L;
	
  	for(scnt=0;scnt<8;scnt++)
  	{
        	if(cmd&0x80)
     			EPD_SI_H;
            	else
			EPD_SI_L;
                    
            	EPD_SCK_H;  
            	EPD_SCK_L;  
            	cmd = cmd<<1;
  	}
	
  	EPD_CS_H;  
  	EPD_SI_L;
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 模组写数据
void EpdSendDat(unsigned char dat)
{
  	unsigned char scnt;

  	EPD_SCK_L;
  	EPD_DC_H;
  	EPD_CS_L;
  
  	for(scnt=0;scnt<8;scnt++)
  	{
    		if(dat&0x80)
      			EPD_SI_H;
    		else
      			EPD_SI_L;
		
    		EPD_SCK_H;  
    		EPD_SCK_L;  
    		dat = dat<<1;
  	}
  
  	EPD_CS_H;  
  	EPD_SI_L;
  	EPD_DC_L;
}

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 模组加载驱动波形
void EpdLoadWaveform(void)
{
  	unsigned char i;
	unsigned char g_Temperature=27;			//环境温度, 0~255摄氏度
	unsigned char* wfptr = (unsigned char*)WF_300MS;

	//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
	//用户需要通过单片机读取温度传感器的值并赋值给"g_Temperature" 
	//若环境温度已确认，则可固定"g_Temperature"为某温度值
	//!!!!!!!! read "g_Temperature" from sensor;	

	if(g_Temperature < 15)
		wfptr = (unsigned char*)WF_700MS;
	else if(g_Temperature < 25)
		wfptr = (unsigned char*)WF_500MS;
	else if(g_Temperature < 35)
		wfptr = (unsigned char*)WF_300MS;
	else
		wfptr = (unsigned char*)WF_200MS;

  	EpdSendCmd(0x32);  			// write LUT register
  	for(i=0;i<29;i++)      			// write LUT register with 29bytes instead of 30bytes 0D3
  	{
    		EpdSendDat(wfptr[i]);
  	}
}

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 模组复位
void EpdReset()
{
  	EPD_CS_H;
  	EPD_DC_L;
  	EPD_SI_L;
  	EPD_SCK_L;  
  	EPD_RST_H;
  	EPD_RST_L;
  	delay_ms(1);                
  	EPD_RST_H;
  	EpdReadBusyStatus();
  	EpdSendCmd(0x12);   			//软件RESET
  	EpdReadBusyStatus();
}
//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 模组进入深度睡眠  注意：进入深度睡眠模式后，不接受命令，只能用硬件RESET才能重新操作，软件RESET也不行。然后需要重新初始化配置。
void EpdEnterDeepSleep()  
{
  	EpdSendCmd(0x10);
	EpdSendDat(0x01);
}

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
//电子纸驱动初始化
void EpdInit(void)
{
	EpdReset();
	
  	EpdSendCmd(0x01);       // Gate Setting
    	EpdSendDat(0xF9);    	// MUX Gate lines=250-1=249(F9H)
    	EpdSendDat(0x00);    	// B[2]:GD=0[POR](G0 is the 1st gate output channel)  B[1]:SM=0[POR](left and right gate interlaced)  B[0]:TB=0[POR](scan from G0 to G319)
		
  	EpdSendCmd(0x3A);       // number of dummy line period   set dummy line for 50Hz frame freq
    	EpdSendDat(0x06);    	// Set 50Hz   A[6:0]=06h[POR] Number of dummy line period in term of TGate
  	EpdSendCmd(0x3B);       // Gate line width   set gate line for 50Hz frame freq
    	EpdSendDat(0x0B);    	// A[3:0]=1011(78us)  Line width in us   78us*(250+6)=19968us=19.968ms
   
  	EpdSendCmd(0x3C);	// Select border waveform for VBD
	//EpdSendDat(0x30);    	// GS0-->GS0
	//EpdSendDat(0x31);    	// GS0-->GS1
	//EpdSendDat(0x32);    	// GS1-->GS0
    	EpdSendDat(0x33);    	// GS1-->GS1  开机第一次刷新Border从白到白
	//EpdSendDat(0x43);    	// VBD-->VSS
	//EpdSendDat(0x53);    	// VBD-->VSH
	//EpdSendDat(0x63);    	// VBD-->VSL
	//EpdSendDat(0x73);    	// VBD-->HiZ
	
	EpdSendCmd(0x11);		// Data Entry mode
    	EpdSendDat(0x01);    	// 01 –Y decrement, X increment
  	EpdSendCmd(0x44);       // set RAM x address start/end, in page 22
	EpdSendDat(0x00);    	// RAM x address start at 00h;
	EpdSendDat(0x0f);    	// RAM x address end at 0fh(15+1)*8->128    0D3
	EpdSendCmd(0x45);		// set RAM y address start/end, in page 22
	EpdSendDat(0xF9);    	// RAM y address start at FAh-1;		    0D3
	EpdSendDat(0x00);    	// RAM y address end at 00h;		    0D3
	
  	EpdSendCmd(0x2C);       // Vcom= *(-0.02)+0.01???
    	EpdSendDat(0x6E);    //-2.1V

  	EpdLoadWaveform();		//load default wf
  	
  	EpdSendCmd(0x21);       // Option for Display Update
    	EpdSendDat(0x03);    	// A[7]=0(Disable bypass)  后面刷新恢复正常的前后2幅图比较
  	EpdSendCmd(0x22);
    	EpdSendDat(0xC7);    	// (Enable Clock Signal, Enable CP) (Display update,Disable CP,Disable Clock Signal) 正常更新顺序
	
  	EpdSendCmd(0x3C);       // board
    	EpdSendDat(0x73);    	// VBD-->HiZ  后面刷新时Border都是高阻
}

//xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
// 图片显示函数
void EpdDisplayPic(unsigned char num)
{
  	unsigned int i,row, col;

	EpdInit();
	
  	EpdSendCmd(0x4E);		  
    	EpdSendDat(0x00);  			// set RAM x address count to 0;
   
  	EpdSendCmd(0x4F);		  
    	EpdSendDat(0xF9);  			// set RAM y address count to 250-1;	0D3
    
	i = 0;
  	EpdSendCmd(0x24);
  	for(col=0; col<250; col++)   		// 总共250 GATE列  // send 128x250bits ram 0D3
  	{
    		for(row=0; row<16; row++)  	// 总共128 SOURCE行(6行冗余)，每个像素1bit,即 128/8=16 字节
    		{
			switch(num)
			{
				case PIC_WHITE:
					EpdSendDat(0xff);
					break;

				case PIC_BLACK:
					EpdSendDat(0x00);
					break;

				case PIC_Name:
		          		EpdSendDat(PIC_Orientation[i]);
		          		break;	

		        	case PIC_Dot:
			          	if(col%2)
			              		EpdSendDat(0xaa);  // 奇数Gate行
			          	else
			              		EpdSendDat(0x55);  // 偶数Gate行
		          		break;  

		        	case PIC_Source_Line:
		          		EpdSendDat(0xaa);  
		          		break;	

		        	case PIC_Gate_Line:
		          		if(col%2)
		              			EpdSendDat(0xff);  // 奇数Gate行
		          		else
		              			EpdSendDat(0x00);  // 偶数Gate行
		          		break;  
					
				default:
					break;
			}
			i++;
		}
    	}
  
  	EpdSendCmd(0x20);
  	EpdReadBusyStatus();
	EpdEnterDeepSleep();
}

#endif
